import React from 'react'
import qs from "qs"
import { useLocation } from 'react-router-dom'

export default function News() {
  const uselocation=useLocation()
  const {a,b}=qs.parse(uselocation.search.split("?")[1])
  const newsList=uselocation.state

  console.log(uselocation.state,"state" )
  return (
    <div>
      <h1>News</h1>
      <p>大新闻吗 {a} {b}</p>
      {
        newsList.map(item=>{
          return <li key={item.id}>{item.name}</li>
        })
      }
    </div>
  )
}
